package com.dyyx.mystarter.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.dyyx.mystarter.properties.MyStarterProperties;
import com.dyyx.mystarter.service.MyStarterService;

@ConditionalOnClass(MyStarterService.class)
@EnableConfigurationProperties(MyStarterProperties.class)
@Configuration
public class MyStarterAutoConfiguration{
	
	
	@Autowired
    private MyStarterProperties myStarterProperties;
    
    @Bean
    @ConditionalOnMissingBean(MyStarterService.class)
    public MyStarterService myStarterService() {
        return new MyStarterService();
    };
	
}
